package Test;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Alger
 * @date 2021/6/29  14:21
 */
public class Test02 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("1", "value1");
        map.put("2", "value2");
        map.put("3", "value3");
        System.out.println(map.containsKey("1"));

        HashMap<String, List<String>> stringListHashMap = new HashMap<>();

        ArrayList<String> strings = new ArrayList<>();
        strings.add("1");
        strings.add("2");
        stringListHashMap.put("1",strings);
        System.out.println(stringListHashMap);



        System.out.println("通过Map.entrySet遍历key和value");
        for (Map.Entry<String, String> entry : map.entrySet()) {
            System.out.println(entry);
        }
        System.out.println(map);
    }
}
